import request from '../utils/request.js'

export const courseAPI = {
  // 获取课程列表
  getCourses: (params = {}) => {
    return request({
      url: '/api/course/list',
      method: 'post',
      data: params
    })
  },

  // 根据ID获取课程详情
  getCourseById: (id) => {
    return request({
      url: '/api/course/getById',
      method: 'post',
      data: { id }
    })
  },

  // 新增课程
  addCourse: (data) => {
    return request({
      url: '/api/course/add',
      method: 'post',
      data
    })
  },

  // 更新课程
  updateCourse: (data) => {
    return request({
      url: '/api/course/update',
      method: 'post',
      data
    })
  },

  // 删除课程
  deleteCourse: (id) => {
    return request({
      url: '/api/course/delete',
      method: 'post',
      data: { id }
    })
  }
}